const getters = {
  sidebar: state => state.app.sidebar,
  device: state => state.app.device,
  token: state => state.user.token,
  name: state => state.user.userInfo.username,
  staffPhoto: state => state.user.userInfo.staffPhoto,
  companyId: state => state.user.userInfo.companyId,
  points: state => {
    if (state.user.userInfo.roles) {
      return state.user.userInfo.roles.points
    }
  },
  companyName: state => state.user.userInfo.companyName,
  departmentName: state => state.user.userInfo.departmentName,
  theme: state => state.settings.theme
  // 定义全局的getters 方便我们在.vue组件中使用
  // getters 是基于state派生出的状态, 写法类似于 计算属性
  // $store.state.user.token --> $store.getters.token
  // name1: state => state.user.name
}
export default getters
